From: Mikhail Gavrilov Date: Sun, 12 Apr 2026 13:14:01 +0000 (+0500) Subject: screencastService: Add rate control to VA-API H.264 pipelines X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~10^2^2~32 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7b6d39c204f2e552af3230c189ef2239e062f995;p=gnome-shell.git screencastService: Add rate control to VA-API H.264 pipelines The vah264enc and vah264lpenc pipelines do not specify any rate control parameters, causing the encoder to use its default bitrate. At 4K this results in ~12 Mbit/s recordings — roughly 18x larger than the VP8 software fallback (~630 kbit/s) with no visible quality benefit for typical screencast content. All other pipelines in the PIPELINES array constrain quality explicitly: openh264enc uses qp-max=26/qp-min=26, vp8enc uses max-quantizer=17 and buffer-size=20000. Only the two VA-API pipelines are left unconstrained. Add rate-control=vbr bitrate=2048 target-percentage=50 to both VA-API pipelines. This produces ~1 Mbit/s average / 2 Mbit/s peak, which is comparable to what the other encoders produce and works across both AMD (which lacks CQP) and Intel VA-API implementations. Before (4K, 5s recording): 11688 kb/s, 7.2 MB After (4K, 5s recording): 2472 kb/s, 1.6 MB Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9165 Part-of: --- diff --git a/js/dbusServices/screencast/screencastService.js b/js/dbusServices/screencast/screencastService.js index 117eb4494..d70bbb15b 100644 --- a/js/dbusServices/screencast/screencastService.js +++ b/js/dbusServices/screencast/screencastService.js @@ -36,7 +36,7 @@ const PIPELINES = [ pipelineString: 'capsfilter caps=video/x-raw(memory:DMABuf),format=DMA_DRM,max-framerate=%F/1 ! \ vapostproc ! \ - vah264lpenc ! \ + vah264lpenc rate-control=vbr bitrate=2048 target-percentage=50 ! \ queue ! \ h264parse ! \ mp4mux fragment-duration=500 fragment-mode=first-moov-then-finalise', @@ -47,7 +47,7 @@ const PIPELINES = [ pipelineString: 'capsfilter caps=video/x-raw(memory:DMABuf),format=DMA_DRM,max-framerate=%F/1 ! \ vapostproc ! \ - vah264enc ! \ + vah264enc rate-control=vbr bitrate=2048 target-percentage=50 ! \ queue ! \ h264parse ! \ mp4mux fragment-duration=500 fragment-mode=first-moov-then-finalise',